var tools = require('../../common/tools-dev');
var fs = require('fs');
var child_process = require('child_process');
var path = require('path');
var replace = require('replace');
var _ = require('lodash');
var argv = require('yargs').argv;
console.log('npm-cmd', process.argv);

var cmd = process.argv[2];
if (!cmd) {
	console.log('please input command');
	process.exit(1);
}

const baseEnv = {
	...process.env,
};

const shell = function(cwd, cmd) {
	return child_process.execSync(cmd, { stdio: 'inherit', cwd });
};

module.exports.dev = function() {
	var isWin = /^win/.test(process.platform);
	var script = isWin ? 'gradlew.bat assemble' : './gradlew assemble';
	let buildType = 'release';
	let presets = shell('./', 'readlink --m ./node_modules/babel-preset-env');
	shell('./', `npx babel-watch --preset=${presets} run.js`);
};

module.exports[cmd]();
